
#ifndef   __SIMPHONY_MENU
#define   __SIMPHONY_MENU

#define   NEW_PREFIX__PREFIX						STR__PREFIX_____
#define   NEW_PREFIX__UNIT_LONG					STR__UNITLONG___
#define   NEW_PREFIX__CONNECTION_COST			STR__CON_COST___
#define   NEW_PREFIX__UNIT_COST					STR__UNIT_COST__
#define   NEW_PREFIX__SAVE							STR___SAVE__



#define   SHOW_MENU_STRINGS					3

#define   MAIN_MENU_ITEM_COUNT				5
#define   MESSAGES_MENU_ITEM_COUNT			6			
#define   PHONE_SETUP_ITEM_COUNT				7
#define   MESSAGE_SEND_SAVE_ITEM_COUNT		3
#define   BILLING_ITEM_COUNT					3
#define   PREFIX_ITEM_COUNT					5
#define   PREFIX_LIST_VIEW_STRING_COUNT	3
//#define   PREFIX_LIST_VIEW_ITEM_COUNT		150

#define   KEY_DOWN	'#'
#define   KEY_UP		'*'

#define   KEY_RIGHT	KEY_DOWN
#define   KEY_LEFT	KEY_UP

extern unsigned char* ListView[3];

#define   Prefix_ListView	ListView
#define   SMS_List_View		ListView
#define   CDR_ListView		ListView

typedef struct MD
{
		unsigned char DisplayStringCount;	/* How many strings to display*/
		unsigned char DisplayString; 			/* Focus string */
		unsigned int ItemsCount;	
		unsigned char Item;
		void ( *ItemHandler )  ( void );
		const char** Menu;
		unsigned char** Menu_RAM; 
		struct MD *Back;

}MENU_DESCRIPTOR;

extern bit NOT_TO_UPDATE;

extern unsigned long PrefixToEditOrDelete;

extern unsigned char Menu_Current_Item;
extern unsigned char DisplayStringNumber;

extern unsigned char SysState_If_Password_OK;
extern MENU_DESCRIPTOR* GoTo_If_Password_OK;
extern MENU_DESCRIPTOR* GoTo_If_OKAY;
extern MENU_DESCRIPTOR* CurrentMenu;

extern MENU_DESCRIPTOR MainMenu;
extern MENU_DESCRIPTOR MessagesMenu;
extern MENU_DESCRIPTOR AdvServMenu;
extern MENU_DESCRIPTOR GlobTimersMenu;
extern MENU_DESCRIPTOR LastCallsMenu;
extern MENU_DESCRIPTOR PhoneSetupMenu;
extern MENU_DESCRIPTOR MessageSendSaveMenu;
extern MENU_DESCRIPTOR BillingMenu;
extern MENU_DESCRIPTOR PrefixMenu;
extern MENU_DESCRIPTOR PrefixListView;
extern MENU_DESCRIPTOR MyPhoneNumberMenu;
extern MENU_DESCRIPTOR NMS_PhoneNumberMenu;
extern MENU_DESCRIPTOR VoiceMail_PhoneNumberMenu;
extern MENU_DESCRIPTOR SMS_Service;
extern MENU_DESCRIPTOR SMS_Service;
extern MENU_DESCRIPTOR SMS_ListView;
extern MENU_DESCRIPTOR Installer_Main_Menu;
extern MENU_DESCRIPTOR Installer_Boot_Menu;
extern MENU_DESCRIPTOR CDR_History;


void NMS_PhoneNumber_Handler ( void );

void InitPrefix ( void );
void UpdateMenu( void );
void MenusInit( void );
//void MoveCursor( unsigned char Direct );

/* Display parameters */
#define   STRING_SIZE			20
#define   DISPLAY_STR			3	  /* the lines are shows on the display */
#define   DISPLAY_SIZE			(STRING_SIZE * DISPLAY_STR)
/*  */
#define   STRING_COUNT			4

#define   MESSAGE_SIZE			160
//#define   WINDOW_SIZE		3	  /* Lines of LCD display */

/* typedef struct  */
/* { */
/* 		unsigned char Window[WINDOW_SIZE][STRING_SIZE]; */
/* }DISPLAY_WINDOW; */

extern unsigned char MessageEditor[MESSAGE_SIZE+1];
extern unsigned char EditorSize;
extern unsigned char pWrite;

//extern const char CVS_Date[]; 
extern const char Revision_Basic[]; 

/* typedef union  */
/* { */
/* 		unsigned char Buffer[16]; */
/* 		unsigned char STR[4][4]; */
/* }MY_BUFFER; */

//extern MY_BUFFER mbf; 

  
/* typedef union */
/* { */
/* 		unsigned char Chars[MESSAGE_SIZE]; */
/* 		unsigned char Strings[STRING_COUNT][STRING_SIZE]; */
/* }EDITOR; */


/* SMS message editor maximum of chars is 160 */

//extern EDITOR Editor;
//extern unsigned char CharsCount; 			/* Global Bytes Count */
//extern unsigned char CurrentStr; 					/* String pointer(counter) */
//extern unsigned char CurrentChar;
//extern unsigned char pEditStr;
//extern unsigned char pEditChar;
//extern unsigned char EditorCurPos_Char;
//extern unsigned char EditorCurPos_Str;

void GetChar ( unsigned char Ch );
void ClearEditor ( void );
void UpdateEditor ( unsigned char* p );
void PrefixEditor( void );
unsigned char LoadMyPhoneNumber( void );

void MessagesMenu_Handler( void );

//extern unsigned char MesEdit[STRING][CHARS];

#endif


